package me.j360.springboot.simple.web;

import me.j360.springboot.simple.entity.User;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with springbootweb -> me.j360.springboot.simple.web.
 * User: min_xu
 * Date: 2015/7/29
 * Time: 14:13
 * 说明：
 */

@RestController
@RequestMapping(value="/system")
public class SystemController {

    @RequestMapping(value="/{user}", method= RequestMethod.GET)
    public User getUser(@PathVariable Long user) {
        return new User(user.toString());
    }
    @RequestMapping(value="/{user}/customers", method=RequestMethod.GET)
    List<User> getUserCustomers(@PathVariable Long user) {
        List<User> list = new ArrayList<User>();
        list.add(new User(user.toString()));
        return list;
    }
    @RequestMapping(value="/{user}", method=RequestMethod.DELETE)
    public User deleteUser(@PathVariable Long user) {
        return new User(user.toString());
    }


    /*@RequestMapping(value = "/test")
    public String test(Device device) {
        if (device.isMobile()) {
            System.out.println("Hello mobile user!");
        } else if (device.isTablet()) {
            System.out.println("Hello tablet user!");
        } else {
            System.out.println("Hello desktop user!");
        }
        return "test";
    }*/
}
